// 如果有一个超级大的文本，该怎么处理?文本的体积超过了内存的大小

const fs = require('fs')
const path = require('path')
const util = require('util')
const { EventEmitter } = require('events');
console.log(EventEmitter);
const readable = fs.createReadStream(path.join(__dirname, 'file/test.txt'), { encoding: 'utf8', highWaterMark: 1024 })

let int = 0
readable.on('data', (data) => {
	int++
	console.log(data);
	console.log('===');
	if (int % 10 == 0) {
		readable.pause();
		setTimeout(() => {
			readable.resume();
		}, 3000);
	}
});


